//package com.cskaoyan.catmall.service.Impl;
//
//import com.cskaoyan.catmall.dao.WxAddressMapperXGQ;
//import com.cskaoyan.catmall.model.bo.WxListBoXGQ;
//import com.cskaoyan.catmall.model.vo.WxAddressListVoXGQ;
//import com.cskaoyan.catmall.model.vo.WxListVoXGQ;
//import com.cskaoyan.catmall.service.WxAddressServiceXGQ;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Isolation;
//import org.springframework.transaction.annotation.Propagation;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.List;
//
///**
// * 创建日期: 2022-01-10-20-38
// * author : XGQ
// * description: WxAddressService的实现类
// */
//@Service
//@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRES_NEW,noRollbackFor = Exception.class)
//public class WxAddressServiceXGQImpl implements WxAddressServiceXGQ {
//    @Autowired
//    WxAddressMapperXGQ wxAddressMapperXGQ;
//
//    //地址列表
//    @Override
//    public WxAddressListVoXGQ getAddressList() {
//        //获取地址相关信息
//        List<WxListVoXGQ> list = wxAddressMapperXGQ.getAll();
//        //确认地址个数
//        Integer total = 0;
//        for (WxListVoXGQ wxListVoXGQ : list) {
//            total++;
//        }
//        //只有一页，所以limit = total，pages=page=1
//        Integer limit = total;
//        Integer pages = 1;
//        Integer page = 1;
//        return WxAddressListVoXGQ.list(total,pages,limit,page,list);
//    }
//
//    //新增地址并返回新增的id
//    @Override
//    public Integer getIdAndSave(WxListBoXGQ wxListBoXGQ) {
//        // id为0是新增地址，不为0是修改地址
//        Integer id = wxListBoXGQ.getId();
//        if (id == 0){
//            wxAddressMapperXGQ.saveInfoAndSave(wxListBoXGQ);
//            //获取新增id值
//            id = wxListBoXGQ.getId();
//        } else {
//            wxAddressMapperXGQ.updateInfoById(wxListBoXGQ);
//        }
//
//        return id;
//    }
//
//    //逻辑删除
//    @Override
//    public void deleteAddress(Integer id) {
//        wxAddressMapperXGQ.addressDeleteById(id);
//    }
//
//
//    @Override
//    public WxListVoXGQ getDetailAddress(Integer id) {
//        WxListVoXGQ wxListVoXGQ = wxAddressMapperXGQ.getDetailAddress(id);
//        return wxListVoXGQ;
//    }
//}
